/*
 * Seeker.cpp
 *
 *  Created on: Jun 11, 2011
 *      Author: wilsok17
 */

#include "Seeker.h"
#include <cstdlib>
#include <time.h>
#include <iostream>

Seeker::Seeker(int id) {
	seekerID_ = id;
	currentStep_ = 0;
}

Seeker::~Seeker() {

}

SeekerReport Seeker::intersectionReached(){
	/* Test code to randomly determine the route statu
	int reportType = rand() % 5;
	cout << reportType << endl;
	*/
	int reportType = 0;

	// determine the status from the sensors detecting IEDs and breaks in the road and set report type

	switch (reportType) {
	case 0:
		return reportIED();
	case 1:
		return reportObstruction();
	default:
		return reportIntersection();
	}
	//move();
}

SeekerReport Seeker::reportIntersection(){
	SeekerReport report;
	report.lastRouteLegComplete_ = currentStep_;
	report.pathStatus_ = 0;
	report.seekerID_ = seekerID_;
	++currentStep_;
	report.currentLeg_ = currentStep_;
	return report;
}

SeekerReport Seeker::reportIED() {
	SeekerReport report;
	report.lastRouteLegComplete_ = currentStep_;
	report.currentLeg_ = currentStep_;
	report.pathStatus_ = 1;
	report.seekerID_ = seekerID_;
	return report;
}

SeekerReport Seeker::reportObstruction(){
	SeekerReport report;
	report.lastRouteLegComplete_ = currentStep_;
	report.currentLeg_ = currentStep_;
	report.pathStatus_ = 2;
	report.seekerID_ = seekerID_;
	return report;
}

void Seeker::receiveInstructions(list<pair<string, DIRECTION> > seekerRoute) {
	seekerRoute_ = seekerRoute;
	currentStep_ = 0;
}


